<?php
// 本类由系统自动生成，仅供测试用途

namespace Home\Controller;
use Think\Controller;

class IndexController extends Controller {
    public function index()
    {
        $title="requirejs with wohome";
        $array["title"]=$title;
        $array["cont"]="hello world";
        $this->assign($array);
        $this->display();
    }

    public function loginDo(){
        $phone=I('get.userPhone');
        $password=I("get.userPsd");
        $result=array();
        if($phone=="18611001820" && $password=="497761497"){
            $result["code"]="000000";
            $result['status']=1;
            $this->ajaxReturn($result);
        }else{
            $result["code"]="000222";
            $result['status']=0;
            $this->ajaxReturn($result);
        }
    }

    public function test(){
        $result["code"]="0000000";
        /*$this->ajaxReturn($result);*/
        $info="测试消息";
        trace($result,"提示");
		$name=I('get.bookname');
		$this->show($name);

    }

    public function home(){
        date_default_timezone_set('PRC');
        $startTimeStr = "2014-03-11 00:00:00";
        $endTimeStr = "2014-03-12 23:59:59";
        $startTime = strtotime($startTimeStr);
        $endTime = strtotime($endTimeStr);
        $nowTime = time();
        if ($nowTime < $startTime) {
            die("活动还没开始,活动时间是：{$startTimeStr}至{$endTimeStr}");
        }
        $leftTime = $endTime - $nowTime; //实际剩下的时间（秒）
        $arr["title"]="wohome";
        $arr["time"]=$leftTime;
        $this->assign($arr);
        $this->display("wohome");
    }
}